using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;using Maxleaf.EDI.Domain.K3;

namespace Maxleaf.EDI.DataAccess.K3
{
    public class t_CustEntryMap : EntityTypeConfiguration<t_CustEntry>
    {
        public t_CustEntryMap()
        {
            // Primary Key
            this.HasKey(t => new { t.FBrNo, t.FCustID, t.FItemID, t.FEntryID, t.FUnitID, t.FEndQty, t.FUsed });

            // Properties
            this.Property(t => t.FBrNo)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.FCustID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FItemID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FEntryID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FUnitID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FEndQty)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FNote)
                .HasMaxLength(255);

            // Table & Column Mappings
            this.ToTable("t_CustEntry");
            this.Property(t => t.FBrNo).HasColumnName("FBrNo");
            this.Property(t => t.FCustID).HasColumnName("FCustID");
            this.Property(t => t.FItemID).HasColumnName("FItemID");
            this.Property(t => t.FEntryID).HasColumnName("FEntryID");
            this.Property(t => t.FUnitID).HasColumnName("FUnitID");
            this.Property(t => t.FStartQty).HasColumnName("FStartQty");
            this.Property(t => t.FEndQty).HasColumnName("FEndQty");
            this.Property(t => t.FPrice).HasColumnName("FPrice");
            this.Property(t => t.FCyID).HasColumnName("FCyID");
            this.Property(t => t.FDiscount).HasColumnName("FDiscount");
            this.Property(t => t.FLeadTime).HasColumnName("FLeadTime");
            this.Property(t => t.FNote).HasColumnName("FNote");
            this.Property(t => t.FExpireDate).HasColumnName("FExpireDate");
            this.Property(t => t.FQuoteTime).HasColumnName("FQuoteTime");
            this.Property(t => t.FUsed).HasColumnName("FUsed");
        }
    }
}
